package busca.tesoros.uclm;


import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;


public class MapaGoogleActivity extends MapActivity{
	

	private MapView map;
	private MapController controller;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mapa);
		initMapView();
		initMyLocation();
    }	

	private void initMapView() {
		map = (MapView) findViewById(R.id.map);
		controller = map.getController();
		map.setSatellite(true);
		map.setBuiltInZoomControls(true);		
	}
	
	private void initMyLocation() {
		final MyLocationOverlay overlay = new MyLocationOverlay(this, map);
		overlay.enableMyLocation();
	    //overlay.enableCompass();
		overlay.runOnFirstFix(new Runnable() {
			public void run() {
				controller.setZoom(8);
	            controller.animateTo(overlay.getMyLocation());
	        }
	    });
	    map.getOverlays().add(overlay);
   }
	   
	@Override
	protected boolean isRouteDisplayed() {
		return false;
	} 	   
};

